'use strict';
/**
 * @name: 小程序封装淘宝的top接口
 * @description: 针对于框架进行了封装
 * @version: 0.0.1
 * @author: xiech
 * @Date: 2020-12-10 13:53:30
 * @LastEditors: xiech
 * @LastEditTime: 2020-12-10 13:53:30
 */

module.exports = async (ctx) => {
  const mftop = {};
  const topApi = ctx.cloud.topApi;
  /**
   * @description: top接口
   * @param {string} api 集合
   * @param {object} data 数据
   * @return {object} top接口数据
   */
  mftop.topApi = async (api, data) => {
    const result = await topApi.invoke({
      autoSession: true,
      api,
      data,
    });
    return result;
  };
  return mftop;
}